// const md5 = require('md5');
const path_save_file = './uploadFiles';
const { saveFile } = require('../utils/fsHandles/write');

const uploadFunc = async (req,res,next) => {
	const { file } = req;
	try{
		await saveFile({
			rootPath:path_save_file,
			file
		});
		res.status(200).send({ success:true });
	}catch(err){
		res.status(200).send({ success:false,message:'保存失败',err });
	}
	next();
};

module.exports = { uploadFunc };
